import java.io.*;
import java.util.*;

class Test {
	public void t1(int i) throws RuntimeException {
		if(i%2==0) throw new RuntimeException("Exception in t1");	
	}
	public void t2(int i) throws Exception {
		try {
			if(i%2==0) throw new IOException("IOException in t2");
		}
		catch(Exception ex) {
			throw ex;
		}
	}
	public void t3() throws Exception {
		System.out.println(1/0);
	}
}

class Main {
	public static void main(String[] args) {
		Test test=new Test();
		//test.t1(0);
		try {
			test.t2(0);
		} catch(IOException ex) {
			System.out.println("==========================================");
			ex.printStackTrace();
			System.out.println("==========================================");
			StackTraceElement[] traces=ex.getStackTrace();
			for(StackTraceElement trace: traces) {
				System.out.println(trace.getClassName() + "." + trace.getMethodName() + "() at " + trace.getFileName() + ":" + trace.getLineNumber());
			}
			System.out.println("==========================================");
		} catch(Exception ex) {
			System.out.println(ex);
		}
	}
}
